package com.kris.train;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;



// 缓冲区 流读取
public class BufInpStreamDev {

	
	public static void main(String[] args) throws ParseException{
		String st = "2018/06/09 17:54:18";
		String et = "2018/06/09 08:00:00";
		System.out.println(BufInpStreamDev.retStateByTime(st, et));
	}
	
	public  static Integer retStateByTime(String sDt,String eDt) throws ParseException{
		int state = 10;
		SimpleDateFormat sim = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
		Date dateStart = sim.parse(sDt);// 转
		Date dateEnd = sim.parse(eDt);
		int st = (int) (dateStart.getTime()/1000);
		int et = (int) (dateEnd.getTime()/1000);
		int now = (int) (new Date().getTime()/1000);// 当前时间
		if(now<st){
			state = 10;
		} else if(now>st && now<et){
			state = 20;
		} else{
			state = 30;
		} 
		return state;
	}
}
